In a state where workpieces, which are objects to detect, are not properly positioned but placed randomly in a container, an application for picking up the workpieces, commonly referred to as “random bin picking,” detects the workpieces by a camera that photographs a wide range, in order to acquire position information with respect to a workpiece to pick up. At this time, a search window used for detecting the workpieces is fixed and set inside the container in which the workpieces are accommodated. However, when, for example, the position of the container is changed by replacing the container, or the height of workpieces that can be detected changes due to the increase or decrease of the number of workpieces, the position and size of the search window becomes inadequate. Then, problems occur where, for example, workpieces are not found in the search window, unwanted objects are captured in the search window and cause misdetection, the search window is too large and the detection consumes additional time, and so on.
Furthermore, an application for “random bin picking” might operate such that, after a rough position of a workpiece is obtained by a fixed camera that photographs a wide range, information about the accurate position of the workpiece is acquired by a hand camera that is mounted in a robot, and the workpiece is picked up. At this time, the robot calculates the position to photograph the workpiece by the hand camera, based on the rough position of the workpiece acquired from the image photographed by the fixed camera, and tries to move to the position determiend by the calculation. However, when the robot moves to the position to photograph the workpiece by the hand camera, the hand camera and the hand that are mounted in the robot, and the peripheral system equipment, including the container in which the workpiece is accommodated, interfere with each other, and the workpiece may be photographed from a position where interference is avoided. Then, given that the workpiece is photographed by the hand camera in a different robot position and posture from the setting, problems occur where, for example, the workpiece is not found in the search window, unwanted objects are captured in the search window and cause misdetection, the search window is too large and the detection consumes additional time, and so on.
A scheme for teaching a plurality of windows that detect the features of a workpiece from an image, and determining which window to use according to an input from an external device, is known (see, for example, patent literature 1). Furthermore, based on a method of detecting the edges of the components mounted on a substrate, a component edge detection method and device characterized in that, when detecting the edge of a component in the first edge detection step and a second edge detection step, in the second edge detection step, adjusting the position and size of the search window to to be used in the second edge detection step using the edge position detected in the first edge detection step (see, for example, patent literature 2).
Patent Literature 1: JP-A-1-147676
Patent Literature 2: JP-A-2006-49347
The search window control scheme illustrated in patent literature 1 is effective in that, when the amounts of displacement of the container and the robot are determined in advance, a corresponding search window has only to be set. However, when the amounts of displacement are not determined in advance, an enormous number of search windows have to be set in order to cope with all possible situations, which is not suitable for practical use. Furthermore, with the component edge detection method and device illustrated in patent literature 2, the position and size of the search window used in the second edge detection are adjusted based on the detected position of the first edge in the same component. However, if many workpieces that are stacked randomly in a container are detection targets, a search window does not have to be provided for every workpiece, and only one search window that covers a necessary and sufficient area inside the container depending on the amount of displacement of the container has to be provided. With the method of patent literature 2, it is not possible to create such a desirable search window. In addition, it is not possible to adequately change the size of the search window depending on the height of the contents stacked in the container. Furthermore, if the hand camera is shifted from the teaching position to avoid interference, a search window to reflect the amount of this shift is needed. With the method of patent literature 2, it is not possible to create such a search window.